home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / jce.jar / javax / crypto / CipherInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-07-27  |  1.8 KB  |  159 lines

  1. package javax.crypto;
  2.  
  3. import java.io.FilterInputStream;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6.  
  7. public class CipherInputStream extends FilterInputStream {
  8.    // $FF: renamed from: a javax.crypto.Cipher
  9.    private Cipher field_0;
  10.    // $FF: renamed from: b java.io.InputStream
  11.    private InputStream field_1;
  12.    // $FF: renamed from: c byte[]
  13.    private byte[] field_2 = new byte[512];
  14.    // $FF: renamed from: d boolean
  15.    private boolean field_3 = false;
  16.    // $FF: renamed from: e byte[]
  17.    private byte[] field_4;
  18.    // $FF: renamed from: f int
  19.    private int field_5 = 0;
  20.    // $FF: renamed from: g int
  21.    private int field_6 = 0;
  22.  
  23.    // $FF: renamed from: a () int
  24.    private int method_0() throws IOException {
  25.       if (this.field_3) {
  26.          return -1;
  27.       } else {
  28.          int var1 = this.field_1.read(this.field_2);
  29.          if (var1 == -1) {
  30.             this.field_3 = true;
  31.  
  32.             try {
  33.                this.field_4 = this.field_0.doFinal();
  34.             } catch (IllegalBlockSizeException var3) {
  35.                this.field_4 = null;
  36.             } catch (BadPaddingException var4) {
  37.                this.field_4 = null;
  38.             }
  39.  
  40.             if (this.field_4 == null) {
  41.                return -1;
  42.             } else {
  43.                this.field_5 = 0;
  44.                this.field_6 = this.field_4.length;
  45.                return this.field_6;
  46.             }
  47.          } else {
  48.             try {
  49.                this.field_4 = this.field_0.update(this.field_2, 0, var1);
  50.             } catch (IllegalStateException var5) {
  51.                this.field_4 = null;
  52.             }
  53.  
  54.             this.field_5 = 0;
  55.             if (this.field_4 == null) {
  56.                this.field_6 = 0;
  57.             } else {
  58.                this.field_6 = this.field_4.length;
  59.             }
  60.  
  61.             return this.field_6;
  62.          }
  63.       }
  64.    }
  65.  
  66.    public CipherInputStream(InputStream var1, Cipher var2) {
  67.       super(var1);
  68.       this.field_1 = var1;
  69.       this.field_0 = var2;
  70.    }
  71.  
  72.    protected CipherInputStream(InputStream var1) {
  73.       super(var1);
  74.       this.field_1 = var1;
  75.       this.field_0 = new NullCipher();
  76.    }
  77.  
  78.    public int read() throws IOException {
  79.       if (this.field_5 >= this.field_6) {
  80.          int var1;
  81.          for(var1 = 0; var1 == 0; var1 = this.method_0()) {
  82.          }
  83.  
  84.          if (var1 == -1) {
  85.             return -1;
  86.          }
  87.       }
  88.  
  89.       return this.field_4[this.field_5++] & 255;
  90.    }
  91.  
  92.    public int read(byte[] var1) throws IOException {
  93.       return this.read(var1, 0, var1.length);
  94.    }
  95.  
  96.    public int read(byte[] var1, int var2, int var3) throws IOException {
  97.       if (this.field_5 >= this.field_6) {
  98.          int var4;
  99.          for(var4 = 0; var4 == 0; var4 = this.method_0()) {
  100.          }
  101.  
  102.          if (var4 == -1) {
  103.             return -1;
  104.          }
  105.       }
  106.  
  107.       if (var3 <= 0) {
  108.          return 0;
  109.       } else {
  110.          int var5 = this.field_6 - this.field_5;
  111.          if (var3 < var5) {
  112.             var5 = var3;
  113.          }
  114.  
  115.          if (var1 != null) {
  116.             System.arraycopy(this.field_4, this.field_5, var1, var2, var5);
  117.          }
  118.  
  119.          this.field_5 += var5;
  120.          return var5;
  121.       }
  122.    }
  123.  
  124.    public long skip(long var1) throws IOException {
  125.       int var3 = this.field_6 - this.field_5;
  126.       if (var1 > (long)var3) {
  127.          var1 = (long)var3;
  128.       }
  129.  
  130.       if (var1 < 0L) {
  131.          return 0L;
  132.       } else {
  133.          this.field_5 = (int)((long)this.field_5 + var1);
  134.          return var1;
  135.       }
  136.    }
  137.  
  138.    public int available() throws IOException {
  139.       return this.field_6 - this.field_5;
  140.    }
  141.  
  142.    public void close() throws IOException {
  143.       this.field_1.close();
  144.  
  145.       try {
  146.          this.field_0.doFinal();
  147.       } catch (BadPaddingException var2) {
  148.       } catch (IllegalBlockSizeException var3) {
  149.       }
  150.  
  151.       this.field_5 = 0;
  152.       this.field_6 = 0;
  153.    }
  154.  
  155.    public boolean markSupported() {
  156.       return false;
  157.    }
  158. }
  159.